home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
cenvid
/
autoexec.cmm
< prev
next >
Wrap
Text File
|
1995-10-20
|
1KB
|
45 lines
// AutoExec.cmm - Loaded for CEnvi shell, which is if CEnvi
// ver.1 is executed with no arguments.
//
// This version runs INSTALL.CMM and then
// replaces instal with an AUTOEXEC.CMM that
// does nothing.
main(argc,argv)
{
if defined(_NTCON_)
{
printf("NT Install must be run from CENVIWNT.EXE. Please run it first\n");
exit(0);
}
// get full name of AUTOEXEC.CMM
FullName = FullPath(argv[0]);
// Run the INSTALL.CMM script in same directory
sprintf(InstallScript,"%sINSTALL.CMM",SplitFileName(FullName).dir);
if ( !Directory(InstallScript) ) {
printf("\aCannot find \"%s\"!\n",InstallScript);
exit(EXIT_FAILURE);
}
interpret(InstallScript);
// replace AUTOEXEC.CMM with one that does nothing, or delete it
if ( !(fp = fopen(FullName,"wt")) ) {
// couldn't open. Maybe must fix attribute
system("attrib -r -h -s %s",FullName);
suspend(3000);
fp = fopen(FullName,"wt");
if ( !(fp = fopen(FullName,"wt")) ) {
// try to delete, but that's all we can do
remove(FullName);
exit(EXIT_FAILURE);
}
}
fprintf(fp,"// AutoExec.cmm - Loaded for CEnvi shell, which is if CEnvi\n");
fprintf(fp,"// ver.1 is executed with no arguments.\n");
fclose(fp);
// really exit CEnvi including the shell
abort(TRUE);
}